package com.jndv.phoneconfig.fragment;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.google.gson.Gson;
import com.jndv.phoneconfig.PublicConstant;
import com.jndv.phoneconfig.R;
import com.jndv.phoneconfig.command.BatteryCommand;
import com.jndv.phoneconfig.websocket.JWebSocketClient;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.util.HashMap;
import java.util.Map;

public class DeviceInfoFragment extends BaseFragment {

    TextView tvNum;

    @Override
    public int getLayoutId() {
        return R.layout.fragment_device_info;
    }

    @Override
    protected void initView(View view) {
        tvNum=view.findViewById(R.id.tv_num);
        sendMessage(PublicConstant.BATTERY,"");
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onBatteryEvent(BatteryCommand event) {
        tvNum.setText(event.battery+"%");
    }
}
